#!/usr/bin/python  
# -*- coding: utf-8 -*-  
'''
Created on 2016年6月16日

@author: yangzhou1
'''
import codecs
def toJieba():
    f = open('user.dict','a')  
    c = open('words-content.dic','r')  
    
    for cline in c.readlines():  
        f.write( cline.strip('\n') +" 3" )#最终保存文件的编码，可以自给改  
        f.write('\n')  
    f.close()    
    c.close()  
def mergeJieba():
    #保存结果    
    sg=codecs.open('sougou.dict','r','utf-8')
    sgf=codecs.open('sougou-finance.dict','r','utf-8')
     
    dupsg = {}.fromkeys(sg.readlines()).keys()
    dupsgf = {}.fromkeys(sgf.readlines()).keys()
    f = codecs.open('sougou-merge.dict','w','utf-8')  
    for l in dupsg:  
        f.write(l)
    for ll in dupsgf:
        if ll not in dupsg:
            f.write(l)
    f.close()
if __name__ == '__main__':  
    mergeJieba()